/*
 * @Descripttion: 
 * @version: 
 * @Author: TT
 * @Date: 2022-07-11 15:35:17
 * @LastEditors: TT
 * @LastEditTime: 2022-07-11 15:58:40
 */

import 'package:flutter/material.dart';
import 'package:hzy_normal_widget/hzy_normal_widget.dart';

import '../../../components/common_index.dart';
import '../../utils/common_sp_util.dart';

class LaunchChangeC extends CommonGetXController {
  static LaunchChangeC get current => Get.find<LaunchChangeC>();

  /// 切换语言
  void changelaunch({required launchStr}) async {
    List list = launchStr.split('_');
    String languageCode = 'zh';
    String countryCode = "CN";
    if (list.length == 2) {
      languageCode = list[0];
      countryCode = list[1];
    }
    var locale = Locale(languageCode, countryCode);
    await Get.updateLocale(locale);
    await CommonSpUtil.saveLauchType(launch: launchStr);
  }
}
